[XEN] Fill in runstate_info when virtual address is registered,
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 23 Oct 2006 12:10:24 +0000 (13:10 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 23 Oct 2006 12:10:24 +0000 (13:10 +0100)
even when it is registered from the 'wrong' VCPU.
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/domain.c

index 53d22417dc9a5fd6e277d05ade11afe7c9e656d8..3e0a2f82ae2204fe97814599420c2fa7dd59d4ec 100644 (file)
@@ -378,6 +378,7 @@ arch_do_vcpu_op(
     case VCPUOP_register_runstate_memory_area:
     {
         struct vcpu_register_runstate_memory_area area;
+        struct vcpu_runstate_info runstate;
 
         rc = -EFAULT;
         if ( copy_from_guest(&area, arg, 1) )
@@ -390,8 +391,15 @@ arch_do_vcpu_op(
         v->runstate_guest = area.addr.v;
 
         if ( v == current )
+        {
             __copy_to_user(v->runstate_guest, &v->runstate,
                            sizeof(v->runstate));
+        }
+        else
+        {
+            vcpu_runstate_get(v, &runstate);
+            __copy_to_user(v->runstate_guest, &runstate, sizeof(runstate));
+        }
 
         break;
     }